home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 …ember: Reference Library / Dev.CD Dec 97 RL.toast / What's New / Tool Chest / Testing & Debugging / Virtual User / Examples / Example Scripts / MouseChaos.vu < prev    next >
Encoding:
Text File  |  1997-10-15  |  1.3 KB  |  47 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        MouseChaos.vu
  3. #
  4. #    Contains:    A very simple VU script that illustrates the use of the system tasks  
  5. #                random(), and mouseSpeed().  Simply run it against any target machine.
  6. #                The theSeed variable sets the random seed used when creating a random 
  7. #                number.  To repeat a series of random numbers, set the theSeed parameter 
  8. #                to the same value as a pervious test.
  9. #
  10. #    Conventions:    Global variables begin with a "g"
  11. #
  12. #    Written by:    Jay Jessen
  13. #
  14. #    Copyright:    © 1990-1992 by Apple Computer, Inc., all rights reserved.
  15. #
  16. #    Change History (most recent first):
  17. #
  18. #         <4>     12/3/92    RV        
  19. #        8/19/92        DGG        Made into parametric script.  Included use of RandomSeed
  20. #         7/7/92        DGG        Clean up for VU 2.0
  21. #        5/17/90        JAS        Create globals numberOfMoves and maxMouseSpeed.  A few small
  22. #                            changes in comment header.
  23. #        
  24. #        11/7/89           Jay        creation
  25. #
  26. #    To Do:
  27. #
  28.  
  29. script MouseChaosMain(gNumberOfMoves := 20, gMaxMouseSpeed := 20, theSeed )
  30. begin
  31.     if IsUndefined(theSeed)
  32.         theSeed := Random();
  33.     println "The random seed is ",theSeed;
  34.     RandomSeed(theSeed);
  35.     
  36.     match [screen m:true r:?Screen_rect]!;
  37.     xHi := Screen_rect[3];
  38.     yHi := Screen_rect[4];
  39.     for i := 1 to gNumberOfMoves 
  40.     begin
  41.         MouseSpeed(random(0,gMaxMouseSpeed));
  42.         x := random(,xHi);
  43.         y := random(,yHi);
  44.         println '(',x,',',y,')';
  45.         move a: { x,y };
  46.     end;    
  47. end;